// PlotterFactory.h - MARIN MSG Anneke Sicherer-Roetman 20080609

#include <string.h>
#ifndef _WINDOWS
#include "mermaid.h"
#endif
#include "PlotterFactory.h"

// all known Plotters:
#include "PgPlotter.h"
#include "OsgPlotter.h"

/// creates a plotter based upon its name
/// @return pointer to plotter object
Plotter *PlotterFactory::create(const char *name,           ///< name of plotter to create
                                int xmin,                   ///< lower left of area (datapoints)
                                int ymin,                   ///< lower left of area (datapoints)
                                int xmax,                   ///< upper right of area (datapoints)
                                int ymax,                   ///< upper right of area (datapoints)
                                float dx1,                  ///< horizontal point interval
                                float dx2,                  ///< vertical point interval
                                const Array2D<float> &plot, ///< datapoints to plot
                                const std::string &caption, ///< text to display
                                float fmin,                 ///< minimum data value
                                float fmax)                 ///< maximum data value
{
/*
    if (!strcmp(name, "pg"))
    {
        return new PgPlotter(xmin, ymin, xmax, ymax, plot, caption, fmin, fmax);
    }
    else 
*/
    if (!strcmp(name, "osg"))
    {
        return new OsgPlotter(xmin, ymin, xmax, ymax, dx1, dx2, plot, caption);
    }
    else
    {
        return new Plotter(xmin, ymin, xmax, ymax, plot, caption); // does nothing
    }
    return 0;
}
   
